package _06PrototypeDesignPattern;

public class DeepClone {
    public static void main(String[] args) {
        //参考 https://blog.csdn.net/goskalrie/article/details/50790056
        DeepAddress deepAddress=new DeepAddress("deep",99);
        DeepPerson deepPerson=new DeepPerson(33,"java","88",deepAddress);
        DeepPerson deepPerson1=deepPerson.clone();
        System.out.println(deepPerson);
        System.out.println(deepPerson1);
        deepPerson1.setAge("11");
        deepPerson.getAddress().setAdd("deepClone更改了");
        System.out.println(deepPerson);
        System.out.println(deepPerson1);
        /**
         *综上所述，所谓深度克隆就是还在其引用对象的类中在实现一个clone方法
         * 每个对象都是有基本的数据类型所形成的
         * 因此我们只要记住克隆的本质是什么就好
         */

    }

}
